<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>我的生活</title>
    <meta name="viewport" content="initial-scale=1, maximum-scale=1">

    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">

    <link rel="stylesheet" href="http://g.alicdn.com/msui/sm/0.6.2/css/sm.min.css">
    <link rel="stylesheet" href="http://g.alicdn.com/msui/sm/0.6.2/css/sm-extend.min.css">
    <link rel="stylesheet" type="text/css" href="../css/filmplay.css">
    <style type="text/css">
      .infinite-scroll-preloader {
        margin-top:-30px;
      }
      </style>
    <script>
        window.onload=function () {
            var Mycollect=document.getElementById("Mycollect");
            var star=document.getElementById("star");
            var collect=document.getElementById("collect");
            var isClicked = false;
            Mycollect.onclick=function () {
                if (!isClicked) {
                    collect.style.color = 'rgba(114,184,230,1)';
                    isClicked=true;
                }
                else {
                    collect.style.color = 'rgba(197,197,198,1)';
                    isClicked=false;
                }
            }
        }
    </script>
  </head>
  <body>
    <div class="page-group" style="height:648px;">
        <div class="page page-current">
            <header class="bar bar-nav" style="background:#ffffff;">
            <h1 class="title" id="MyFilmplay"></h1>
            <a href="#">
               <label class="share">分享</label>
            </a>
            </header>
            <div>
            <nav class="bar bar-tab">
               
                <a class="tab-item external" id="comment" href="#">
                    <span class="tab-label">我要评论</span>
                </a>
                <a class="tab-item external" href="#" id="Mycollect">
                    <span class="icon icon-star" id="star"></span>
                    <span class="tab-label" id="collect">收藏</span>
                </a>
            </nav>
            <div class="content infinite-scroll infinite-scroll-bottom" data-distance="100">
                <div class="list-block">
                    <ul class="list-container">
                        <li>
                            <div id="video">
                                 <video width="375" height="220" controls>
                                    <source src="" type="video/mp4" id="FilmSource">
                                    <object data="" width="375" height="220" id="FilmObject">
                                        <embed src="" width="375" height="220" id="FilmData">
                                    </object> 
                                </video>
                            </div>
                        </li>
                    </ul>
                </div>
                <div class="infinite-scroll-preloader">
                    <div class="preloader"></div>
                </div>
            </div>

        </div>
    </div>

    <script type='text/javascript' src='http://g.alicdn.com/sj/lib/zepto/zepto.min.js' charset='utf-8'></script>
    <script type='text/javascript' src='http://g.alicdn.com/msui/sm/0.6.2/js/sm.min.js' charset='utf-8'></script>
    <script type='text/javascript' src='http://g.alicdn.com/msui/sm/0.6.2/js/sm-extend.min.js' charset='utf-8'></script>
     <script type='text/javascript' src='../js/utils.js'></script>

    <script type="text/javascript">
        $(document).ready(function () {
            var username=$('#name').val();
            var password=$('#password').val();

            AjaxIO.post("/getEbookJson", {loginId: username, password: password},
                         function (result) {
                            $('#FilmSource').attr("src",result.data.filmUrl);
                            $('#FilmObject').attr("data",result.data.filmUrl);
                            $('#FilmData').attr("src",result.data.filmUrl);
                            $('#MyFilmplay').html(result.data.filmName);
          });
        })
    </script>
    <script>
        var loading = false;
      // 最多可加载的条目
      var maxItems = 6;

      // 每次加载添加多少条目
      var itemsPerLoad = 3;

      function addItems(number, lastIndex) {
         var username=$('#name').val();
        var password=$('#password').val();

          AjaxIO.post("/getMarkFilmJson", {loginId: username, password: password},function(result){
              var html = '';
              for (var i = lastIndex ; i < lastIndex + number; i++) {
                  html += '<li class="ucercomment"> <div style="border-top: solid #dfe5ee 1px;margin-top:20px;"><label class="comment_name">' + result[i].data.commentName + '</label><label class="comment_time">' + result[i].data.commentTime + '</label><p class="comment_content">' + result[i].data.commentContent + '</p></div></li>';
              }
             $('.infinite-scroll-bottom .list-container').append(html);

          })

      }
          //预先加载3条
      addItems(itemsPerLoad, 0);

      // 上次加载的序号

      var lastIndex = 3;

      // 注册'infinite'事件处理函数
      $(document).on('infinite', '.infinite-scroll-bottom',function() {

          // 如果正在加载，则退出
          if (loading) return;

          // 设置flag
          loading = true;

          // 模拟1s的加载过程
          setTimeout(function() {
              // 重置加载flag
              loading = false;

              if (lastIndex >= maxItems) {
                  // 加载完毕，则注销无限加载事件，以防不必要的加载
                  $.detachInfiniteScroll($('.infinite-scroll'));
                  // 删除加载提示符
                  $('.infinite-scroll-preloader').remove();
                  return;
              }

              // 添加新条目
              addItems(itemsPerLoad, lastIndex);
              // 更新最后加载的序号
              lastIndex += 3;
              //容器发生改变,如果是js滚动，需要刷新滚动
              $.refreshScroller();
          }, 1000);
      });
    </script>

  </body>
</html>